<template>
  <div v-loading="pagelistLoading">
    <div class="bgf">
      <!-- <my-form
        v-model="queryParams"
        :config="fromConfigdetales"
        :slotleft-list="['inp']"
        :slot-list="['add']"
        @submit="searchHandle"
        @reset="resetQuery"
        @change="searchHandle"
      >
        <div slot="inp" style="margin-right: 0.1rem">
          <el-input
            v-model="queryParams.Key"
            size="small"
            placeholder="输入预约活动名称搜索"
          />
        </div>
      </my-form> -->
    </div>
    <div class="bgf">
    <MyTable
      :column="column"
      :data="list"
      :page-sizes="[50, 100, 200, 500]"
      :current-page.sync="totalParams.skipcount"
      :total="total"
      fromConfigdetale
      :page-size="totalParams.maxresultcount"
      pagination
      layout="total,sizes,prev,pager,next,jumper"
      @size-change="changePagination"
      @p-current-change="changecurrent"
      @handleCurrentChange="selectRow"
    />
    </div>
<!-- <el-dialog
  title="提示"
  :visible.sync="dialogModelVisible"
  width="30%"
  :before-close="handleClose">
  <span>这是一段信息</span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogModelVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogModelVisible = false">确 定</el-button>
  </span>
</el-dialog> -->
    <el-dialog :visible.sync="dialogModelVisible" :close-on-click-modal="false" width="600px">
      <dialogViewForm v-model="formParams" :config="datafromConfig" @submit="formHandle" @cancel="cancelFormAction" />
    </el-dialog>
    
  </div>
</template>
<script>
// import MyForm from "@/components/MyForm/FormGenerator";
import dialogViewForm from "@/components/MyForm/dialogViewForm.vue";
import page from "@/mixins/page";
import { fromConfigdetale } from "../column/MakeTableclumn.js";
import { formatDate, formatTimeString } from "@/utils/date.js";
const datafromConfig = {
  fieldsConfig: [
    {
      name: 'DaterangeTimeArr',
      label: '时间范围',
      date: ['QueryBeginTime', 'QueryEndTime'],
      fieldType: 'DateTimePicker',
      format: 'yyyy/MM/dd HH:mm:ss',
      type: 'datetimerange',
      // rules: 'required'
    },
    {
      name: 'eurCanName',
      label: '食堂名称',
      rules: 'required',
      fieldType: 'TextInput'
    },
    {
      name: 'eurLoginName',
      label: '登录账号',
      rules: 'required',
      fieldType: 'TextInput'
    },
    {
      name: 'eurLoginphone',
      label: '手机号',
      rules: 'required',
      fieldType: 'TextInput'
    },
    {
      name: 'eurDptId',
      label: '所属街道',
      fieldType: 'SelectList',
      rules: 'required',
      optionsurl: 'GetVilList'
    },
    {
      name: 'eurCanAddress',
      label: '食堂地址',
      rules: 'required',
      fieldType: 'TextInput'
    },
    {
      name: 'eurName',
      label: '负责人',
      fieldType: 'TextInput'
    },
    {
      name: 'eurType',
      label: '食堂类别',
      fieldType: 'SelectListNew',
      optionsurl: 'GetAchEurTypeList',
      rules: 'select'
    },
    {
      name: 'eurType',
      label: '政治面貌',
      fieldType: 'SelectListNew',
      date: { codeProp: 'codCode', codCode: 'VopPloTypeCode', codeName: 'VopPloTypeName' },
      optionsurl: 'getPoliticsOptions',
      rules: 'select'
    },
  ],
  buttons: {}
}
export default {
  name: "User",
  components: {
    // MyForm,
    dialogViewForm,
  },
  filters: {},
  mixins: [page],
  data() {
    return {
      datafromConfig:datafromConfig,
       queryParams: {
       maxresultcount: 50,
       skipcount: 1
      },
       formParams: {
        eurCanName: '',
        eurLoginName: '',
        eurLoginphone: '',
        eurLoginPassword: '',
        eurCanAddress: '',
        eurName: '',
        eurNames: '',
        eurType: '',
        eurDptId: '',
      },
      dialogTableVisible: false,
      gridData: [],
      totalParams: {},
      listAurInfo: [],
      column: [
        {
          label: '操作',
          width: 80,
          fixed: 'left',
          render: (h, scope) => {
            return (
              <div>
                <el-button
                  type="primary"
                  size="mini"
                  onClick={() => {
                    this.queryAction(scope.row, true)
                  }}
                >
                  详情
                </el-button>
              </div>
            )
          }
        },
        {
          type: 'index',
          label: '序号',
          width: 60
        },
        {
          prop: 'eurLoginName',
          label: '账号ID',
          width: 100,
          showOverflowTooltip: true
        },
        {
          prop: 'eurCanName',
          label: '食堂名称',
          align: 'left',
          showOverflowTooltip: true
        },
        {
          prop: 'eurCanAddress',
          label: '所在地址',
          align: 'left',
          showOverflowTooltip: true
        },
        {
          prop: 'eurDptName',
          label: '所属街道',
          showOverflowTooltip: true
        },
        {
          prop: 'eurName',
          label: '负责人',
          width: 80,
          showOverflowTooltip: true
        },
        {
          prop: 'eurNames',
          label: '政治面貌',
          width: 80,
          showOverflowTooltip: true
        },
        {
          prop: 'creationTime',
          label: '创建时间',
          showOverflowTooltip: true
        },
        {
          prop: 'eurTypeName',
          label: '分类',
          width: 80
        },
      ],
      fromConfigdetales: fromConfigdetale(this),
      httpUrl: "GetAchEurListAll",
      dialogModelVisible:false,
    };
  },
  methods: {
    cancelFormAction() {
      this.dialogModelVisible = false
    },
     handleClose(done) {
        this.$confirm('确认关闭？')
          .then(_ => {
            done();
          })
          .catch(_ => {});
      },
    queryAction(obj){
      this.formParams = { ...obj }
      this.dialogModelVisible=true
    },
    selectRow(val) {},
    queryListArr(item) {
      this.api.QueryAurInfo({ id: item.apnid }).then((res) => {
        this.dialogTableVisible = true;
        this.listAurInfo = res;
      });
    },
    changeHandle() {
      this.httpGetListActions();
    },
    resetQuery() {
      this.queryParams = {
        cityid: "0",
        AreaId: "0",
        orgid: "0",
        times: null,
        status: null,
        Key: null,
      };
      this.httpGetListActions();
    },
        formHandle() {
          console.log('成功',this.formParams)
      // this.disabledBut = true
      // if (this.formParams.id) {
      //   this.UpdateAchEur(this.formParams).then(res => {
      //     this.$message({ type: 'success', message: '编辑成功!' })
      //     this.cancelFormAction()
      //     this.httpGetListActions()
      //     this.disabledBut = false
      //   })
      // } else {
      //   this.InsertAchEur(this.formParams).then(res => {
      //     this.$message({ type: 'success', message: '添加成功!' })
      //     this.cancelFormAction()
      //     this.httpGetListActions()
      //     this.disabledBut = false
      //   })
      // }
      // console.log(this.disabledBut)
    },
  },
};
</script>
